package com.zgjkhis.modules.charges.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author yzq
 * @Description 发票
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_prescription_refund_detail")
public class PrescriptionRefundDetail implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "退款单号")
    private String refundNo;
    @ApiModelProperty(value = "业务id")
    private String businessId;
    @ApiModelProperty(value = "项目id,药品id")
    private String projectId;
    @ApiModelProperty(value = "项目名称,药品名称")
    private String name;
    @ApiModelProperty(value = "退款个数")
    private Integer refundNum;
    @ApiModelProperty(value = "退款金额")
    private BigDecimal refund;
    @ApiModelProperty(value = "退款金额(折扣)")
    private BigDecimal refundPrice;
    @ApiModelProperty(value = "退款类型，1:药物退款，2：项目退款，3：药材加工费退款，4：邮寄费用，5：其他费用")
    private Integer refundType;
    @ApiModelProperty(value = "订单号")
    private String orderNo;
    @ApiModelProperty(value = "处方号")
    private String infoNo;

    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "药房id",required = true)
    @NotNull(message = "药房id不能为空")
    private String pharmacyId;

    public void copy(PrescriptionRefundDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
